# def r_file():
#     a = 10 
#     b = 0 
#     try:
#         rst = a / b 
#         print("1.计算结果",rst)
#         return rst 
#     except :
#         print("2,出现异常")
#     finally:
#         print("3.程序执行结束")
# r_file()
# print("______________________________")    
def w_file():
    file =None
    try:
        file = open("hiahia.txt","w")
        a=10
        b = 0 
        rst = a / b 
        file.write(f"haha:{rst}")
    except Exception as e :
        print("出现异常：",e,type(e))
    finally:
        if file is not None:
            file.close()
            print("关闭资源")
            
        
w_file()


